#ifndef __DATA_BUS_H
#define __DATA_BUS_H

typedef unsigned int uint32_t;


#define DATA_BUS_TYPE_CHAR 1
#define DATA_BUS_TYPE_INT 2
#define DATA_BUS_TYPE_STRING 3
#define DATA_BUS_TYPE_FLOAT 4


#define DATA_BUS_BUFF_SIZE 1024
#define DATA_BUS_DATA_SIZE 512


typedef struct __DATA_BUS {
    char name[16];
    unsigned char type;
    unsigned short int length;
    int index;

    void (*trigger)(struct __DATA_BUS data);
} DATA_BUS;


int data_bus_add_data(char *name, char type, int length, void *trigger);

int data_bus_find_data_index_by_name(char *name);

int data_bus_change_data_by_name(char *name, char *value);

int data_bus_change_data_by_index(int index, char *value);

DATA_BUS data_bus_get_data_by_name(char *name);

DATA_BUS data_bus_get_data_by_index(int index);

char *data_bus_get_data_value_by_name(char *name);
#endif